package com.shxc.smarttrade.old.myview;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;

/**
 * Created by jcdev1 on 2017/7/10.
 */

public class GradationScrollView extends ScrollView {
    private ScrollViewListener listener = null;

    public GradationScrollView(Context context) {
        super(context);
    }

    public GradationScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public GradationScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public void setScrollViewLsitener(ScrollViewListener listener) {
        this.listener = listener;
    }

    public interface ScrollViewListener {
        void onScrollViewChange(GradationScrollView scrollView, int x, int y, int oldX, int oldY);
    }

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        super.onScrollChanged(l, t, oldl, oldt);
        if (listener != null) {
            listener.onScrollViewChange(this, l, t, oldl, oldt);
        }
    }
}
